class CreateLodgings < ActiveRecord::Migration
  def self.up
    create_table :lodgings, :force => true do |t|
      t.references :tour_group, :null => false
      t.references :hotel
      t.decimal :lodging_cost, :precision => 8, :scale => 2, :default => 0, :null => false
      t.timestamps
    end
    execute "ALTER TABLE lodgings ADD CONSTRAINT fk_lodging_tour_group FOREIGN KEY (tour_group_id) REFERENCES tour_groups(id)"
  end
  
  def self.down
    drop_table :lodgings
  end
end
